package com.gitee.taotaojs.myboot.controller;

import com.gitee.taotaojs.myboot.bean.DemoBean;
import com.gitee.taotaojs.myboot.service.DemoService;
import com.gitee.taotaojs.mybootsuper.controller.MyBatchController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//import org.springframework.security.access.annotation.Secured;

/**
 * @author TaoTaojs
 * @date 2020/8/24 3:59 PM
 * <p>Description</p>
 * <h2>功能描述</h2>
 * deme的Controller类
 * <h3>主要功能：</h3>
 * <ol>
 *     <li>TODO</li>
 * </ol>
 * <h3>关联类</h3>
 * <p>参考链接：</p>
 * <h2>更新日志</h2>
 * [author]        [time]                      [version]          [desc]
 * TaoTaojs        2020/8/24 3:59 PM             V1.0
 */
@RestController
@RequestMapping("/demo")
@Slf4j
public class DemoController extends MyBatchController<DemoBean> {

    @Autowired
    private DemoService demoService;

    /**
     * 查询所有，测试权限
     * @return 测试
     */
    @GetMapping("/findAll")
//    @Secured("ROLE_PRODUCT")
    public List<DemoBean> hello() {
        return beanService.findObjectList(DemoBean.builder()
                .name("张三")
                .build());
    }

    /**
     * 查询所有，测试权限
     * @return 测试
     */
    @GetMapping("/demo")
    public String demo() {
        demoService.demo();
        return "完成";
    }

}
